package com.twu.biblioteca;

import java.util.ArrayList;

public class Library {

    ArrayList<Book> bookList = new ArrayList<Book>();
    ArrayList<Movie> movieList = new ArrayList<Movie>();

    public Library(){
        bookList.add(new Book("Great Gatsby", "Fitzgerald"));
        movieList.add(new Movie("Sound of Music", "1965", "Robert Wise"));
    }

    public ArrayList<Book> listBooks(){
        return bookList;
    }

    public boolean contains(Book bookInstance){
        return bookList.contains(bookInstance);
    }

    public void addBook(Book newBook){
        bookList.add(newBook);
    }

    public String toStringBooks(){
        String outputString= "The List of Books:\n";
        for (int bookIndex = 0; bookIndex <bookList.size() ; bookIndex++) {
            outputString+= (bookIndex+1)+ ". "+ bookList.get(bookIndex).toString()+"\n";

        }
        return outputString;
    }


    public boolean availabilityOfBook(Book book) {
        return book.getAvailability();  //To change body of created methods use File | Settings | File Templates.
    }

    public String toStringMovies() {
        String output = String.format("%-30s%-6s%-30s%-3s", "Title", "Year", "Director","Rating" );
        for (int movieIndex = 0; movieIndex < movieList.size(); movieIndex++) {
            output += "haha";
        }
        return output;
    }

    public ArrayList<Movie> listMovies() {
        return movieList;
    }
}
